package com.cyj.comment.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName RedissonConfig
 * @Description Redisson客户端
 * @Author chixiaowai
 * @Date 2023/4/10 16:00
 * @Version 1.0
 */
@Configuration
public class RedissonConfig {
    @Bean
    public RedissonClient redissonClient(){
        Config config = new Config();
        //添加redis地址，这里添加的是单点地址，也渴望已使用config.useClusterServers()添加集群地址
        config.useSingleServer().setAddress("redis://192.168.42.104:6379");
        //创建客户端
        return Redisson.create(config);
    }
}
